const state = {
  typePage: {},
  typeList: [],
  list: [],
  page: {},
  adTypeList: [],
  adTypePage: {},
  childTypeList: []
};
const actions = {
  saveAdTypes: ({ commit }, payload) => {
    console.log("saveAdTypes", payload);
    commit("SAVEADTYPES", payload);
  },
  saveThemeAdlist: ({ commit }, payload) => {
    commit("SAVETHEMEADLIST", payload);
  },
  saveParentAdTypes: ({ commit }, payload) => {
    console.log("aaaaaaaaaa");
    commit("SAVEPARENTADTYPES", payload);
  },
  saveChildTypeList: ({ commit }, payload) => {
    commit("SAVECHILDTYPELIST", payload);
  }
};

const mutations = {
  SAVEPARENTADTYPES: (state, payload) => {
    (state.adTypeList = payload.result),
      (state.adTypePage = {
        size: 10,
        number: payload.number || 1,
        total: payload.resultNum
      });
  },
  SAVEADTYPES: (state, payload) => {
    (state.typeList = payload.result),
      (state.typePage = {
        size: 10,
        number: payload.number || 1,
        total: payload.resultNum
      });
  },
  SAVETHEMEADLIST: (state, payload) => {
    state.list = payload.result;
    state.page = {
      size: 10,
      number: payload.number || 1,
      total: payload.resultNum
    };
  },
  SAVECHILDTYPELIST: (state, payload) => {
    state.childTypeList = payload.result;
  }
};

export default {
  state,
  actions,
  mutations
};
